<template>
	<div>
		<!-- 两个独立的页面：一个时填写表单，表单数据提交后自动切换到另外一个表格展示页面 -->
		<h2>来访人员登记簿</h2>
		<button @click="flag = '1'">登记</button>
		<button @click="flag = '2'">查询</button>
		<keep-alive>
			<my-form v-if="flag === '1'"></my-form>
			<my-table v-if="flag === '2'"></my-table>
		</keep-alive>
	</div>
</template>

<script>
import MyForm from './MyForm'
import MyTable from './MyTable'
export default {
	data() {
		return {
			flag: '1',
		}
	},
	components: { MyForm, MyTable },
}
</script>